﻿/*********************************************************
 * Copyright(c) 2012-2015
 * Author:wangzhonghai
 * description：
 *       1、
 * history：
 *       1、wangzhonghai - 2015/5/5 17:45:15 - Add 
 * *******************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AopAndIocDemo.Biz.Logging;
using PostSharp.Aspects;

namespace AopAndIocDemo.Biz.Aspect
{
    [Serializable]
    public class ExceptionAspect : OnExceptionAspect
    {
        private static readonly LoggerService LoggerService = new LoggerService();

        public override void OnException(MethodExecutionArgs args)
        {
            string msg = String.Format("Exception in :[{0}],Message:[{1}]", args.Method, args.Exception.Message);
            //LoggHelper.WriteLog(LogType.Error, msg);
            LoggerService.Info(msg);

            args.FlowBehavior = FlowBehavior.Continue;

            base.OnException(args);
        }
    }
}
